]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
scroll-view-sizing: Add tests for padding / borders
authorAdel Gadllah <adel.gadllah@gmail.com>
Fri, 16 Sep 2011 19:03:26 +0000 (21:03 +0200)
committerAdel Gadllah <adel.gadllah@gmail.com>
Mon, 19 Sep 2011 16:51:07 +0000 (18:51 +0200)
Add tests to verify that the fade works fine with borders and
padding.

https://bugzilla.gnome.org/show_bug.cgi?id=659159

tests/interactive/scroll-view-sizing.js

index 249e0c367af0561c2e70bba5b1c8b9f22c475da3..e4dffa24b4fc82f8c652c512e78df678bf455942 100644 (file)
@@ -325,10 +325,52 @@ mainBox.add(fadeBox);
 spacer = new St.Bin();
 fadeBox.add(spacer, { expand: true });
 
+fadeBox.add(new St.Label({ text: 'Padding: '}));
+let paddingButton = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;padding-right:3px;' });
+fadeBox.add(paddingButton);
+
+fadeBox.add(new St.Label({ text: 'Borders: '}));
+let borderButton = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;padding-right:3px;' });
+fadeBox.add(borderButton);
+
 fadeBox.add(new St.Label({ text: 'Vertical Fade: '}));
 let vfade = new St.Button({ label: 'No', style: 'text-decoration: underline; color: #4444ff;' });
 fadeBox.add(vfade);
 
+function togglePadding(button) {
+    switch(button.label) {
+    case 'No':
+       button.label = 'Yes';
+       break;
+    case 'Yes':
+       button.label = 'No';
+       break;
+    }
+    if (scrollView.style == null)
+        scrollView.style = (button.label == 'Yes' ? 'padding: 10px;' : 'padding: 0;');
+    else
+        scrollView.style += (button.label == 'Yes' ? 'padding: 10px;' : 'padding: 0;');
+}
+
+paddingButton.connect('clicked', function() { togglePadding(paddingButton); });
+
+function toggleBorders(button) {
+    switch(button.label) {
+    case 'No':
+       button.label = 'Yes';
+       break;
+    case 'Yes':
+       button.label = 'No';
+       break;
+    }
+    if (scrollView.style == null)
+        scrollView.style = (button.label == 'Yes' ? 'border: 2px solid red;' : 'border: 0;');
+    else
+        scrollView.style += (button.label == 'Yes' ? 'border: 2px solid red;' : 'border: 0;');
+}
+
+borderButton.connect('clicked', function() { toggleBorders(borderButton); });
+
 function toggleFade(button) {
     switch(button.label) {
     case 'No':